import { observable, action } from 'mobx-miniprogram'

export const store = observable({
	// 数据字段
	numA: 1,
	numB: 2,
	active: 0,

	// 计算属性
	get sum() {
		return this.numA + this.numB
	},

	// aciton
	updateNumA: action(function() {
		this.numA++
	}),
	changeActive: action(function(index) {
		this.active = index
	})
})
